
library(Amelia)
library(sandwich)
library(foreign)


## set default working directory
setwd("D:/Dropbox/Research/1 power concentration/data/MI")

data <- read.dta("legislature_raw.dta")

a.out=amelia(data, m = 10, idvars = c("prefid", "year", "provid"), empri = 100, logs = c("logpopulation", "logrevenue","logpgdp","tenure", "age","protestall", "proposal", "perproposal"), ords =c("concentration", "gender", "edu_graduate", "homecity", "ethnic", "calender"), incheck = TRUE, max.resample = 1000, tolerance = 0.01)


write.amelia(a.out, file.stem = "leg", format = "dta")
